<script lang="ts">
export default {
  name: 'Study8SonDemo4'
}
</script>

<template>
  <div>
    <p>绑定的值(props):{{ props.mVal }}</p>
    <!-- <input type="text" v-model="props.mVal"> vue3不允许用input双向绑定 -->

    <input
      type="text"
      :value="props.mVal"
      @input="
        (event) => {
          emit('update:mVal', (event.target as HTMLInputElement).value)
        }
      "
    />
  </div>
</template>

<script setup lang="ts">
const props = defineProps(['mVal'])
const emit = defineEmits(['update:mVal'])
</script>

<style scoped>
body {
  padding: 20px;
}
h2 {
  color: red;
}
h3 {
  color: rgb(220, 85, 85);
}
h4 {
  color: skyblue;
}
.hr-style {
  border: 3px solid gold;
  margin: 20px 0;
}
.group {
  border: 4px solid rgb(102, 215, 85);
  margin: 10px;
  padding: 10px;
}
.group3 {
  border: 2px solid rgb(64, 163, 199);
  margin: 10px;
  padding: 10px;
}
.note {
  margin: 10px;
  padding: 10px;
  border: 3px solid rgb(221, 121, 202);
}
.note p {
  color: rgb(226, 106, 204);
  font-weight: bold;
}
</style>
